/*
 * Project it.battlehorse.rcp.tools.log
 * Created on Nov 19, 2005
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * A copy of the LGPL is available also at
 * http://www.gnu.org/copyleft/lesser.html
 * 
 */ 
package it.battlehorse.rcp.tools.log;

import it.battlehorse.rcp.tools.commons.EventType;
import it.battlehorse.rcp.tools.commons.Severity;

import java.util.List;

/**
 * Defines the standard interface to implemented by objects which can be
 * logged.
 * 
 * @author battlehorse
 * @since Nov 19, 2005
 */
public interface ILoggable {
	
	/**
	 * Returns the severity of this log item
	 * 
	 * @return the severity of this log item
	 */
	public Severity getSeverity();
	
	/**
	 * Returns the timestamp associated with the log event
	 * 
	 * @return the timestamp associated with the log event
	 */
	public long getTime();
	
	/**
	 * Returns the source of the event
	 * 
	 * @return the source of the event
	 */
	public Object getSource();
	
	/**
	 * Returns the type of the log event
	 * 
	 * @return the type of the log event
	 */
	public EventType getType();
	
	/**
	 * Returns the log message
	 * 
	 * @return the log message
	 */
	public String getMessage();
	
	/**
	 * Returns an optional list of log subelements
	 * 
	 * @return an optional list of log subelements, or {@code null} if unnecessary.
	 */
	public List<ILoggable> getSubLogs();
	
	/**
	 * Returns the parent log, if any, or {@code null} if this is the root log element
	 * 
	 * @return the parent log, if any, or {@code null} if this is the root log element
	 */
	public ILoggable getParentLog();
	
	/**
	 * Returns the throwable which is associated with this log item. This method should
	 * return a not null object only when the log type is {@code EventType.EXCEPTION_EVENT}.
	 * 
	 * @return the throwable which is associated with this log item
	 */
	public Throwable getThrowable();

}
